package com.aaa.sso.controller;

import com.aaa.common.util.Result;
import com.aaa.sso.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @fileName:UserLoginAndCheckToken
 * @description:
 * @author:zz
 * @createTime:2020/11/12 16:58
 * @version:1.0.0
 */
@RestController
@RequestMapping("ulactController")
public class UserLoginAndCheckToken {


    @Autowired
    private UserService userService;
    /**
     * 用户登录功能
     * @param userName
     * @param password
     * @return
     */
    @GetMapping("userLogin")
    public Result  userLogin(String userName,String password){
        System.out.println(userName+password);
        return  userService.userLogin(userName,password);
    }


    /**
     * 验证token
     * @param accessToken
     * @return
     */
    @GetMapping("checkToken")
    public boolean  checkToken(@RequestParam("accessToken")  String accessToken){
        return userService.checkToken(accessToken);
    }
    /**
     * 退出用户
     * @return
     */
    @PostMapping("loginout")
    public int  loginout(){
        return userService.loginout();
    }

}
